/* eslint-disable */
<template>
	<div class="customDatagroup">
		<!--自定义数据组-->
		<el-dialog class="dateForm" :title="$t('components.customDatagroup.title')" :visible.sync="show"   @close="closeDialog" :close-on-click-modal="false">
			 	<div class="descText">{{$t('components.customDatagroup.remark')}}</div>
				<el-form :rules="rules"  :inline="false" :model="dataSourceRow" ref="dataSourceRow" label-width="90px" >
					<el-row >
						<el-col :span="9">
							<el-form-item  :label="$t('common.resourceName')+':'"  >
								<el-input disabled  v-model="dataSourceRow.resourceName" :placeholder="$t('common.inputPlaceholder')"></el-input>
							</el-form-item>
					    </el-col>
					    <el-col :span="9">
							<el-form-item :label="$t('common.dataGroupName')+':'" >
								<el-input disabled  v-model="dataSourceRow.dataGroupName" :placeholder="$t('common.inputPlaceholder')"></el-input>
							</el-form-item>
					    </el-col>
					    <el-col :span="24">
					    	<el-col :span="9">
					  			<el-form-item :label="$t('common.code')+':'"  prop="nodeCode">
									<el-input clearable  v-model="dataSourceRow.nodeCode" :placeholder="$t('common.inputPlaceholder')"></el-input>
								</el-form-item>
					  		</el-col>
					  		<el-col :span="9">
					  			<el-form-item :label="$t('common.name')+':'"  prop="nodeName">
									<el-input clearable  v-model="dataSourceRow.nodeName" :placeholder="$t('common.inputPlaceholder')"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="9">
					  			<el-form-item :label="$t('common.parentCode')+':'" prop="parentCode">
									<el-input clearable  v-model="dataSourceRow.parentCode" :placeholder="$t('common.inputPlaceholder')"></el-input>
								</el-form-item>
					  		</el-col>
				  			<el-col :span="9" v-if="dataSourceRow.paramType==5">
								<el-form-item :label="$t('common.isusable')+':'" >
									<el-select  v-model="dataSourceRow.isusable" :placeholder="$t('common.selectPlaceholder')" >
										<el-option  v-for="(item,index) in isusableOptions" :key="index" :label="item.label" :value="item.value"></el-option>
									</el-select>
								</el-form-item>
					    	</el-col>
					    	<el-col :span="9" v-if="dataSourceRow.paramType==6 ||dataSourceRow.paramType==11 ">
								<el-form-item :label="$t('common.netCode')+':'" prop="netCode">
									<el-input clearable  v-model="dataSourceRow.netCode" :placeholder="$t('common.inputPlaceholder')"></el-input>
								</el-form-item>
						    </el-col>
					  		<el-col :span="6" >
								<el-button style="margin-left: 20px;" type="primary" @click="onSearch" >{{$t('common.searchBtn')}}</el-button>
							</el-col>
						</el-col>   
					</el-row>
				</el-form>  
					<el-row class="detail">
				    <el-col :span="24" v-if="show">
					    <el-row  v-if="paramStruct==1">
							<el-col v-if="treeType" class="border-box left" :span="12">
					 			<div >
							 		<el-tree :render-content="renderContent" :default-expanded-keys="defaultExpandedKeys"  v-loading="loadind1" :load="loadNode" node-key="code"   @check-change="handleCheckChange" ref="resourceTree" lazy show-checkbox  :props="defaultProps" ></el-tree>
							 	</div>
					 		</el-col>
					 		<el-col v-else class="border-box left" :span="12">
				 				<el-table  stripe height="399" ref="resourceTable" v-loading="loadind1" :data="tableData" style="width: 100%"  @selection-change="selectChange1">
							      <el-table-column type="selection"  width="45"></el-table-column>
							      <el-table-column prop="code" align="left" :label="$t('common.code')" width="62"  show-overflow-tooltip></el-table-column>
							      <el-table-column prop="name" align="left" :label="$t('common.name')"  show-overflow-tooltip> </el-table-column>
							      <el-table-column prop="parentCode" align="left" :label="$t('common.parentCode')" show-overflow-tooltip> </el-table-column>
							    </el-table>
							    <div class="tablebottom">
							    	<el-pagination  
									      @size-change="pageSizeChange1"
									      @current-change="handleCurrentChangePage1"
									      :current-page="pagination1.pageNum"
									      :page-sizes="[10,100, 500, 1000]"
									      :page-size="pagination1.pageSize"
									      :pager-count="5"
									      layout="->,prev, pager, next,sizes, total"
									      :total="pagination1.totalSize">
									</el-pagination>
							    </div>
					 		</el-col>
						 	<el-col class="border-box right" :span="12"  >
				 				<div class="tips">已选&nbsp;&nbsp;&nbsp;({{selectedDataTemp.length}})</div>
				 				<div class="tagList">
				 					<div class="tagItem flex flex-vc" v-for="item in selectedDataTemp" :key="item.code"  closable :disable-transitions="false">
				 						<span class="code treeCode">{{item.code}}</span>
				 						<span class="text" :title="item.code+'/'+item.name">{{item.name}}</span>
										<i @click="handleCloseTreeNode(item)" class="el-tag__close el-icon-circle-close"></i>
				 					</div>
				 				</div>
					 		</el-col>	
					 	</el-row>
					 	<el-row  v-if="paramStruct==0" >
					 		<el-col class="border-box left" :span="12">
				 				<el-table  stripe height="399" ref="resourceTable" v-loading="loadind1" :data="tableData" style="width: 100%"  @selection-change="selectChange1">
							      <el-table-column type="selection"  width="45"></el-table-column>
							      <el-table-column prop="code" align="left" :label="$t('common.code')" width="62"  show-overflow-tooltip></el-table-column>
							      <el-table-column prop="name" align="left" :label="$t('common.name')" show-overflow-tooltip> </el-table-column>
							      <el-table-column prop="parentCode" align="left" :label="$t('common.parentCode')" show-overflow-tooltip> </el-table-column>
							    </el-table>
							    <div class="tablebottom">
							    	<el-pagination  
									      @size-change="pageSizeChange1"
									      @current-change="handleCurrentChangePage1"
									      :current-page="pagination1.pageNum"
									      :page-sizes="[10,100, 500, 1000]"
									      :page-size="pagination1.pageSize"
									      :pager-count="5"
									      layout="->,prev, pager, next,sizes, total"
									      :total="pagination1.totalSize">
									</el-pagination>
							    </div>
					 		</el-col>
					 		<el-col class="border-box right" :span="12"  >
				 				<div class="tips">已选&nbsp;&nbsp;&nbsp;({{selectedDataTemp.length}})</div>
				 				<div class="tagList">
				 					<div class="tagItem flex flex-vc" v-for="item in selectedDataTemp" :key="item.code"  closable :disable-transitions="false">
				 						<span class="code">{{item.code}}</span>
				 						<span class="text" :title="item.code+'/'+item.name">{{item.name}}</span>
											 <i @click="handleClose(item)" class="el-tag__close el-icon-circle-close"></i>
				 					</div>
				 				</div>
					 		</el-col>
					 	</el-row>
				    </el-col>
				</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="closeDialog">{{$t('common.giveUp')}}</el-button>
				<el-button type="primary" @click="submitCustomDatagroup">{{$t('common.save')}}</el-button>
			</div>
		</el-dialog>
	</div>
</template>

<script>
import {
    Message, Notification, MessageBox, Loading
} from 'element-ui'
export default {
    name: 'customDatagroup',
    props: [
        'visible', 'formInfo'
    ],
    data () {
        return {
            show: false,
            dataSourceRow: {},
            rules: {
                startTm: [
			            { required: true, message: this.$t('validateWornText.slectStartTm'), trigger: 'change' }
			        ],
			        endTm: [
			            { required: true, message: this.$t('validateWornText.slectEndTm'), trigger: 'change' }
			        ],
			        resourceName: [
			            { required: true, message: this.$t('validateWornText.selectResourceName'), trigger: 'change' }
			        ]
            },
            pickerOptions1: {
                disabledDate (time) {
			            return (time.getTime() < new Date().getTime() - 24 * 60 * 60 * 1000)
			        }
            },
            paramStruct: 1,
            list: [],
            currentCheckedNodes: [],
            currentCheckedKeys: [],
            defaultExpandedKeys: [],
		        defaultProps: {
		          children: 'children',
		          label: 'name'
		        },
		        tableData: [],
		        pagination1: {
                totalSize: 0,
                pageSize: 10,
                pageNum: 1,
                totalPage: 0
            },
            loadind1: false,
            multipleSelection1: [],
		    chooseSelectionArr1:[],
		    perportyArr:[],
		    selectTagArr:[],
		    selectedData:[],
		    selectedDataTemp:[],
		    currentPageFlag:false,
		    treeType:true,
		    isusableOptions:[{value:0,label:'无效'},{value:1,label:'有效'},{value:'',label:'全部'}],
        }
    },
    watch: {
        visible: 'visibleChange'
    },
    mounted () {
    },
    methods: {
        visibleChange (val) {
            /* 清空选项数据 */
            this.show = val
            if (val) {
				this.treeType=true
				this.multipleSelection1 = []
				this.chooseSelectionArr1 = []
				this.tableData = []
				this.currentCheckedNodes = []
				this.currentCheckedKeys = []
				this.defaultExpandedKeys = []
				this.pagination1 = {
					totalSize: 0,
					pageSize: 10,
					pageNum: 1,
					totalPage: 0
				}
				sessionStorage.removeItem('customDatagroup_resourceList')
				/* 清空选项数据 */
				this.dataSourceRow = {
					startTm: '',
					endTm: '',
					nodeCode:'',
					nodeName:'',
					parentCode:'',
					resourceId:this.formInfo.resourceId,
					dataGroupId:this.formInfo.dataGroupId,
					dataGroupName:this.formInfo.dataGroupName,
					resourceName:this.formInfo.resourceName,
					paramUrl:this.formInfo.paramUrl,
					paramType:this.formInfo.paramType,
					isusable:1,
					netCode:''
				}
				this.selectedData=[]
				this.selectedDataTemp=[]
					/*清空选项数据*/
				if(this.formInfo.paramStruct == 0){
					this.paramStruct=this.formInfo.paramStruct
					this.searchSelectedList()
				}else{
					this.searchSelectedList()		
				}
            }
        },
        checkDateValid (param) {
            if (this.dataSourceRow.startTm != '' && this.dataSourceRow.endTm != '') {
                if (this.dataSourceRow.startTm > this.dataSourceRow.endTm) {
                    this.$message({
					          message: this.$t('common.conmareEndTimeTip'),
					          type: 'warning'
					    })
                    this.dataSourceRow[param] = ''
                }
            }
        },
        closeDialog () {
            this.$refs['dataSourceRow'].resetFields()// 重置表单
	    	if(this.paramStruct==1 && this.treeType){
                this.$refs.resourceTree.setCheckedKeys([])
            }
            this.$emit('customDialogClose')
        },
        submitCustomDatagroup () {
            var that = this
            this.$refs['dataSourceRow'].validate((valid) => {
				if (valid) {
					var tempSelect=this.selectedData
					if(tempSelect.length<1){
						this.$message({
								message: this.$t('common.emptyTip'),
								type: 'warning'
						})
					return
					}
					this.$emit('customDialogSave', that.dataSourceRow, tempSelect)
				} else {
                    return false
                }
            })
        },
        renderContent (h, { node, data, store }) {
			if (node.label == 'test') {
				return (
					<span class="custom-test-node current-test-node">
					<span>{node.label + '/' + data.code}</span>
					</span>)
			} else {
				return (
					<span class="custom-tree-node">
					<span>{node.label + '/' + data.code}</span>
					</span>)
			}
		},
        loadNode (node, resolve) { // 加载树形资源主数据
            var param = {
                dataGroupId: this.dataSourceRow.dataGroupId,
                resourceId: this.dataSourceRow.resourceId,
				code:node.data?node.data.code:0,
				paramUrl:this.dataSourceRow.paramUrl,
            }
				var urlH="/dev-basp-system/resource/selectParams"
		        this.loadind1 = true
            var that = this
            this.$httpExt().post(urlH, param)
			.then((response) => {
				that.loadind1 = false
				var body = response.result.paramsList
				if(body.length==0){
					this.currentPageFlag=false
					return resolve(body);
				}
				if(node.level==0){
					this.defaultExpandedKeys=response.result.parent
				}
				this.defaultCheckedKeys=this.$deepCopy(this.currentCheckedKeys,[]);
				//判断当前展开层级的父节点是否在右边已经被选
				var checkAll=false
				for(var r=0;r<that.selectedData.length;r++){ 
					if(body[0].parentCode==that.selectedData[r].code){//勾选上
						checkAll=true
						break;
					}
				}
				if(checkAll){//父节点被全选，则需要从右侧移除
					for(var i=0;i<body.length;i++){// 检查右侧是否已经有过这个数据
						body[i].status=0;
						var flag=false;
						for(var a=0;a<that.selectedData.length;a++){
							if(that.selectedData[a].code==body[i].code){
								that.selectedData.splice(a,1)
								flag=true;  //已经在右边
								break;
							}
						}
						flag=false;
						for(var b=0;b<that.selectedDataTemp.length;b++){
							if(that.selectedDataTemp[b].code==body[i].code){
								that.selectedDataTemp.splice(b,1)
								flag=true;  //已经在右边
								break;
							}
						}
					}
				}else{ //父节点没有被全选，则只用勾选在右侧的
					for(let a=0;a<body.length;a++){  //避免后台传过来的是已勾选，但是其实在页面已经取消勾选了，所以先清空一遍
						body[a].status=0;
					}
					for(let i=0;i<body.length;i++){// 将右边的已勾选赋值到左边的当前查询列表的satus里
						for(let t=0;t<that.selectedData.length;t++){ 
							if(body[i].code==that.selectedData[t].code){//勾选上
								body[i].status=1;
								break;
							}
						}
					}
				}
				for (let i = 0; i < body.length; i++) {
					if (body[i].status == 1) { // 勾选上
						var index = this.defaultCheckedKeys.indexOf(body[i].code)
						if (index < 0) {
							this.defaultCheckedKeys.push(body[i].code)
						}
					}
				}
				that.$nextTick(() => {
					that.setCheckedKey()
					that.currentPageFlag=false  //先让勾选默认事件执行完
					var eleArr = document.getElementsByClassName('current-test-node')
					for (var i = 0; i < eleArr.length; i++) {
						eleArr[i].parentNode.parentNode.style.display = "none"
						eleArr[i].className = "custom-test-node"
					}
				})
				if (body.length) {
					var temp = {
						code: '-1',
						name: 'test',
						level: body[0].level,
						status: 0,
						parentCode: body[0].parentCode
					}
					body.push(temp)
				}
				return resolve(body)
			}, (response) => {
				this.currentPageFlag=false
				this.loadind1 = false
				Notification.error({
					title: this.$t('common.exception'),
					message: response.msg ? response.msg : this.$t('common.exceptionWornText')
				});
			});
		},
		setCheckedKey(){
			var that=this
			return new Promise((resolve,reject)=>{
				that.$refs.resourceTree.setCheckedKeys(that.defaultCheckedKeys)
				resolve(true)
			})
		},	
		onSearch(){
			this.currentCheckedKeys=[]
			this.pagination1.pageNum = 1;
			if(this.dataSourceRow.nodeCode || this.dataSourceRow.nodeName || this.dataSourceRow.parentCode || this.dataSourceRow.netCode){
				this.treeType=false
			}else{
				this.treeType=true
			}
			this.getSelectFilter()
				
		},
		getSelectFilter(){
			var that=this;
			var arr
			arr = that.selectedData.filter(item => {
				var itemCode = item.code.toLowerCase()
				var nodeCode = this.dataSourceRow.nodeCode.toLowerCase()
				var parentCode = this.dataSourceRow.parentCode.toLowerCase()
				var itemParent = item.parentCode? item.parentCode.toLowerCase():''
				return  itemCode.indexOf(nodeCode)>-1 && item.name.indexOf(this.dataSourceRow.nodeName)>-1 && itemParent.indexOf(parentCode)>-1;
			});
			that.selectedDataTemp = this.$deepCopy(arr,[])
			if(this.paramStruct==1 && !this.dataSourceRow.nodeCode && !this.dataSourceRow.nodeName && !this.dataSourceRow.parentCode && !this.dataSourceRow.netCode){
				return
			}else{
				this.searchResourceList();
			}
		},
		/*树节点选中状态改变*/
		handleCheckChange(node,data){//勾选模块节点change
			//如果这个节点是父节点，并且是data=true,即加入右边，先判断这个node在右边已选列表有没有子节点如果有，把子节点都去掉
			if(data){
				let i,t
				for(i=0;i<this.selectedData.length;i++){
					if(this.selectedData[i].parentCode == node.code){
						this.selectedData.splice(i,1)
						i--
					}
				}
				for(t=0;t<this.selectedDataTemp.length;t++){
					if(this.selectedDataTemp[t].parentCode == node.code){
						this.selectedDataTemp.splice(t,1)
						t--
					}
				}
			}else{//父节点的取消操作
				//两种取消情况：1、手动取消父节点，所有父节点和子节点都要移除；2、全选情况下取消某个子节点导致触发的父节点的取消，那么只能剔除父节点，而且要把子节点加到右边
				//1、手动取消父节点，所有父节点和子节点都要移除 ，那么不需要做特殊处理，正常取消剔除即可
				//2、全选情况下取消某个子节点导致触发的父节点的取消，此时先出发父节点取消勾选动作，先把子节点都加到右边
				var newCheckedNodes = this.$refs.resourceTree.getCheckedNodes();
				var temp = 0
				let i,c
				for(i=0;i<this.selectedData.length;i++){
					if(this.selectedData[i].code == node.code){  //当前父节点在右边才是真正取消操作
						temp =1
					}
				}
				if(temp == 1){
					for(c=0;c<newCheckedNodes.length;c++){
						if(newCheckedNodes[c].parentCode == node.code && newCheckedNodes[c].code!='-1'){
							this.selectedData.push(newCheckedNodes[c])
							this.selectedDataTemp.push(newCheckedNodes[c])
						}
					}
				}
					
			}
			//判断这个子节点的父节点在不在右边，在右边的话，此次勾选是加入右边的勾选，不用加入到右边直接结束
			let tempFlag=0;
			let i
			for(i=0;i<this.selectedData.length;i++){
				if(this.selectedData[i].code == node.parentCode){
					tempFlag = 1
					break
				}
			}
			if(tempFlag==1 && data){  //第一种父节点在右边了子节点加入的时候不做操作
				return
			} 
			this.currentCheckedNodes = this.$refs.resourceTree.getCheckedNodes()
			this.currentCheckedKeys = []
			for(i=0;i<this.currentCheckedNodes.length;i++){
				this.currentCheckedKeys.push(this.currentCheckedNodes[i].code)
			}
			if(data){//加入
				//加入总的已选数组
				var flag=0
				for(var t=0;t<this.selectedData.length;t++){
					if(this.selectedData[t].code == node.code){
						flag =1
					}
				}
				if(flag == 0){
					//把已勾选的加到右边
					this.selectedData.push(node)
				}
				//加入页面可见部分的已选数组
				flag=0
				for(var m=0;m<this.selectedDataTemp.length;m++){
					if(this.selectedDataTemp[m].code == node.code){
						flag =1
					}
				}
				if(flag == 0){
					//把已勾选的加到右边
					this.selectedDataTemp.push(node)
				}	
				
			}else{//取消勾选
				for(let i=0;i<this.selectedData.length;i++){
					if(this.selectedData[i].code == node.code){
						this.selectedData.splice(i,1)
						break
					}
				}
				for(let t=0;t<this.selectedDataTemp.length;t++){
					if(this.selectedDataTemp[t].code == node.code){
						this.selectedDataTemp.splice(t,1)
						break
					}
				}
			}
		},
		toggleSelection (rows, val) { // 设置列表勾选
			if (rows.length) {
				rows.forEach(row => {
					this.$refs[val].toggleRowSelection(row)
				})
			} else {
				this.$refs[val].clearSelection()
			}
		},
		searchResourceList () { // 数据组资源列表
			this.loadind1 = true
			var that = this
			var param={
				code:this.dataSourceRow.nodeCode,
				name:this.dataSourceRow.nodeName,
				parentCode:this.dataSourceRow.parentCode,
				dataGroupId:this.dataSourceRow.dataGroupId,
				resourceId:this.dataSourceRow.resourceId ,
				pageSize:this.pagination1.pageSize,
				pageNum:this.pagination1.pageNum,
				paramUrl:this.dataSourceRow.paramUrl,
				mark:this.dataSourceRow.isusable,
				netCode:this.dataSourceRow.paramType==6?this.dataSourceRow.netCode:null,
				orgIdSour:this.dataSourceRow.paramType==11?this.dataSourceRow.netCode:null,
			}
			var urlH="/dev-basp-system/resource/selectParams"
			if(this.paramStruct==1){  //树形的资源列表搜索
				urlH = '/dev-basp-system/resource/selectParamsList'
			}
			this.$httpExt().post(urlH, param)
			.then((response) => {
				this.loadind1=false;
				var body = response.result
				this.tableData = body.data
				this.pagination1.totalSize=body.totalSize;
				var tempSelectCurrent=[];
				for(var i=0;i<that.tableData.length;i++){
					for(var k=0;k<that.selectedData.length;k++){
						var id1=that.selectedData[k].code
						var id2=that.tableData[i].code
						if(id1==id2){
							tempSelectCurrent.push(that.tableData[i]);
							break;
						}
					}
				}
				this.$nextTick(() => {
					that.toggleSelection(tempSelectCurrent,"resourceTable");
				});		
			
				this.multipleSelection1=tempSelectCurrent;	
			}, (response) => {
				this.currentPageFlag=false
				this.loadind1=false;
				Notification.error({
					title: this.$t('common.exception'),
					message: response.msg? response.msg:this.$t('common.exceptionWornText')
				});
			});
		},
		handleCurrentChangePage1 (val) { // 数据组主数据列表形式分页
			this.chooseSelectionArr1 = this.chooseSelectionArr1.concat(this.multipleSelection1)
            this.pagination1.pageNum = val
            this.searchResourceList()
        },
        pageSizeChange1 (val) { // 数据组主数据列表形式分页
            this.chooseSelectionArr1 = this.chooseSelectionArr1.concat(this.multipleSelection1)
            this.pagination1.pageNum = 1
            this.pagination1.pageSize = val
            this.searchResourceList()
        },
        selectChange1 (val) {
			if(this.currentPageFlag){  //不是手动勾选的，查列表自动带出来的，就不要清除右边的勾选
				return
			}
			//先从右边把当前页全部剔除，再根据已选项加到右边
			const that=this
			//全量隐藏的不经过过滤的数组
			for(let i=0;i<that.tableData.length;i++){
				for(let k=0;k<that.selectedData.length;k++){
					let id1=that.selectedData[k].code
					let id2=that.tableData[i].code
					if(id1==id2){
						that.selectedData.splice(k,1)
						break;
					}
				}
			}
			//把已勾选的加到右边
			that.selectedData= that.selectedData.concat(val)
			
			//经过过滤的数组的剔除
			for(let i=0;i<that.tableData.length;i++){
				for(let j=0;j<that.selectedDataTemp.length;j++){
					let id1=that.selectedDataTemp[j].code
					let id2=that.tableData[i].code
					if(id1==id2){
						that.selectedDataTemp.splice(j,1)
						break;
					}
				}
			}
			//把已勾选的加到右边
			that.selectedDataTemp= that.selectedDataTemp.concat(val)
			this.multipleSelection1 = val;
		},
		handleCloseTreeNode(tag){  //树形的情况下，关闭当前标签
			const that=this
			if(this.treeType){
				//在树的当前勾选数组currentCheckedNodes，如果这个tag存在于当前页面则要手动取消勾选
				this.currentCheckedNodes=this.$refs.resourceTree.getCheckedNodes();
				for(var k=0;k<that.currentCheckedNodes.length;k++){
					if(that.currentCheckedNodes[k].code==tag.code){
						that.currentCheckedNodes.splice(k, 1);
						break;
					}
				}
				for(var i=0;i<that.selectedData.length;i++){
					if(that.selectedData[i].code==tag.code){
						that.selectedData.splice(i, 1);
						break;
					}
				}
				that.selectedDataTemp.splice(that.selectedDataTemp.indexOf(tag), 1);
				that.currentCheckedKeys=[]
				for(let i=0;i<that.currentCheckedNodes.length;i++){
					that.currentCheckedKeys.push(that.currentCheckedNodes[i].code)
				}
				that.$nextTick(() => {
					that.$refs.resourceTree.setCheckedKeys(that.currentCheckedKeys)
				});
			}else{
				this.handleClose(tag)
			}
				
		},
		handleClose(tag){  //关闭当前已选择的标签
			let flag=0
			let that=this
			let tempSelectCurrent=[]
			//在当前页面遍历，如果这个tag存在于当前页面则要手动取消勾选
			for(let k=0;k<that.multipleSelection1.length;k++){
				if(that.multipleSelection1[k].code==tag.code){
					tempSelectCurrent.push(that.multipleSelection1[k]);
					flag=1
					break;
				}
			}
			for(let i=0;i<this.selectedData.length;i++){
				if(this.selectedData[i].code==tag.code){
					this.selectedData.splice(i, 1);
					break;
				}
			}
			this.selectedDataTemp.splice(this.selectedDataTemp.indexOf(tag), 1);
			if(flag==1){
				this.$nextTick(() => {
					that.toggleSelection(tempSelectCurrent,"resourceTable");
				});	
			}			
		},
		searchSelectedList(){
			let param={
				dataGroupId:this.dataSourceRow.dataGroupId,
				resourceId:this.dataSourceRow.resourceId ,
			}
			let urlH="/dev-basp-system/dataGroup/hasParams"
			this.$httpExt().post(urlH, param)
			.then((response) => {
				let body = response.result
				this.selectedData =  body
				this.selectedDataTemp = this.$deepCopy( body,[]) 
				if(this.formInfo.paramStruct == 1){
					this.paramStruct=this.formInfo.paramStruct
				}else{
					this.searchResourceList();
				}
			}, (response) => {
				Notification.error({
					title: this.$t('common.exception'),
					message: response.msg? response.msg:this.$t('common.exceptionWornText')
				});
			});
		},
	}
}
</script>
<style lang="less">
.customDatagroup{
	.el-dialog{
		width:1100px;
	}
	.el-date-editor.el-input, .el-date-editor.el-input__inner {
	    width: 50%;
	}
	.el-form-item {
		width:90%;
		.el-form-item__content{
			width:70%;
		}
	}
	.descText{
		padding-left: 10px;
		font-size: 14px;
	    color: #999CA1;
	    padding-bottom: 30px;
	}
	.el-autocomplete {
	    width: 100%;
	}
	.tapbar{
		width:85%;
		.change-item{
			width:50%;
			height:36px;
			background: #FFFFFF;
			border: 1px solid #DEE1E7;
			box-sizing: border-box;
		}
		.change-item:first-child{
			border-radius: 2px 0 0 0;
		}
		.change-item:last-child{
			border-left:0 !important;
			border-radius: 0 2px 0 0;
		}
		.change-item.active{
			background: #E6F1FC;
			border: 1px solid #A3D0FD;
			color:#1989FA;
		}
	}
	.errorClass{
		.border-box{
			border: 1px solid #f56c6c;
			border-top:0;
		}
		.errorText{
			color: #f56c6c;
		    font-size: 12px;
		    line-height: 1;
		    padding-top: 4px;
		}
		.change-item:first-child{
			border-top: 1px solid #f56c6c;
			border-left: 1px solid #f56c6c;
		}
		.change-item:last-child{
			border-top: 1px solid #f56c6c;
			border-right: 1px solid #f56c6c;
		}
	}
	.border-box{
		border: 1px solid #DCDFE6;
		border-radius: 2px;
		box-sizing: border-box;
		height:436px;
		.tagList{
			overflow: auto;
			height:399px;
			color:#7d8392;
			.tagItem{
				position: relative;
				.code{
					margin-left:16px;
					width:140px;
					margin-right: 20px;
					height:32px;
					line-height: 32px;
				}
			}
			.el-tag__close{
				display:none;
				position: absolute;
				right:3px;
				border-radius: 50%;
			    text-align: center;
			    cursor: pointer;
			    font-size: 16px;
			    height: 18px;
			    width: 18px;
			    line-height: 18px;
			    vertical-align: middle;
			    color:#999;
			}
			.el-tag__close:hover{
    			color: #008CFF;
			}
			.text{
				width:230px;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				display: inline-block;
				height:32px;
				line-height: 32px;
				padding-right: 20px;
			}
		}
		.tagItem:hover .el-tag__close{
			display: block;
		}
		.tagItem:hover{
			background-color: #F2F9FF;
		}
		.el-table{
			color:#7d8392;
		}
		.el-table th{
			padding:6px 0;
			div{
				padding-right: 0;
			}
		}
		.el-table td{
			padding:6px 0;
			border-bottom: 0;
			div{
				padding-right: 0;
			}
		}
	}
	.border-box.left{
		width:540px;
		margin-right: 20px;
		overflow: auto;
	}
	.border-box.right{
		width:500px;
		.tips{
			height:36px;
			line-height: 36px;
			color:#7D8392;
			padding-left: 20px;
			border-bottom:1px solid #ECEEF3;
		}
	}
	.tablebottom .el-pagination {
	    margin-top: 0;
	}
}
</style>
